package net.xdclass.enums;

import lombok.Getter;

/**
 * @Classname BizCodeEnum
 * @Description TODO
 * @Date 2022/4/4 18:39
 * @Created by sunhao
 */
public enum BizCodeEnum {

  /**
   * 通用操作码
   */
  OPS_REPEAT(110001,"重复操作"),

  /**
   *验证码
   */
  CODE_TO_ERROR(240001,"接收号码不合规"),
  CODE_LIMITED(240002,"验证码发送过快"),
  CODE_ERROR(240003,"验证码错误"),
  CODE_CAPTCHA(240101,"图形验证码错误"),
  MAIL_TO_ERROR(240005,"接收邮箱不合规"),
  CODE_CAPTCHA_NOT_EXIT(240102,"图形验证码不存在或已过期"),
  /**
   * 账号
   */
  ACCOUNT_REPEAT(250001,"账号已经存在"),
  ACCOUNT_UNREGISTER(250002,"账号不存在"),
  ACCOUNT_PWD_ERROR(250003,"账号或者密码错误"),
  ACCOUNT_NOT_LOGIN(250004,"账号未登录"),


  /**
   * 收获地址
   */
  ADDRESS_NOT_EXIT(270001,"收货地址不存在"),

  /**
   * token
   */
  TOKEN_EXPIRATION_TIME(260001,"登录失效 请重新登录!"),
  TOKEN_ERROR(260002,"认证失败!"),


  /**
   * 优惠券
   */
  COUPON_CONDITION_ERROR(270001,"优惠券条件错误"),
  COUPON_UNAVAILABLE(270002,"没有可用的优惠券"),
  COUPON_NO_EXITS(270003,"优惠券不存在"),
  COUPON_NO_STOCK(270005,"优惠券库存不足"),
  COUPON_OUT_OF_LIMIT(270006,"优惠券领取超过限制次数"),
  COUPON_OUT_OF_TIME(270407,"优惠券不在领取时间范围"),
  COUPON_GET_FAIL(270407,"优惠券领取失败"),
  COUPON_RECORD_LOCK_FAIL(270409,"优惠券锁定失败"),

  /**
   * 商品
   */
   PRODUCT_NOT_EXIT(290001,"商品不存在"),

  /**
   * 订单
   */
  ORDER_CONFIRM_COUPON_FAIL(280001,"创建订单-优惠券使用失败,不满足价格条件"),
  ORDER_CONFIRM_PRICE_FAIL(280002,"创建订单-验价失败"),
  ORDER_CONFIRM_LOCK_PRODUCT_FAIL(280003,"创建订单-商品库存不足锁定失败"),
  ORDER_CONFIRM_ADD_STOCK_TASK_FAIL(280004,"创建订单-新增商品库存锁定任务失败"),
  ORDER_CONFIRM_TOKEN_NOT_EXIST(280008,"订单令牌缺少"),
  ORDER_CONFIRM_TOKEN_EQUAL_FAIL(280009,"订单令牌不正确"),
  ORDER_CONFIRM_NOT_EXIST(280010,"订单不存在"),
  ORDER_CONFIRM_CART_ITEM_NOT_EXIST(280011,"购物车商品项不存在"),

   PAY_ORDER_PAY_TIMEOUT(310001,"支付超时"),
   PAY_ORDER_CALLBACK_NOT_SUCCESS(310002,"支付订单回调失败"),
   PAY_ORDER_FAIL(310003,"订单支付失败"),

  ORDER_ORDER_RENEWED_PAY(310004,"订单不存在或已支付、超时"),

  CONTROL_FLOW(410000,"服务限流"),
  CONTROL_DEGRADE(410001,"服务降级"),
  CONTROL_PARAM_FLOW(410002,"热点参数限流"),
  CONTROL_SYSTEM_FLOW(410003,"系统拦截"),
  CONTROL_AUTHORITY(410004,"授权拦截"),
  CONTROL_UNKNOWN(410005,"未知异常"),
  ;
  @Getter
  private Integer code;

  @Getter
  private String message;

  BizCodeEnum(Integer code, String message) {
    this.code = code;
    this.message = message;
  }
}
